// written by entire team

#include "HTMLOutputter.h";
#include "Event.h"
#include "Appt.h"
#include "XMLParser.h"
#include "Filter.h"
#include "DayTime.h"
#include "DayParser.h"
#include <iostream>
#include <cctype>
#include "EventProcessor.h"
#include <sstream>
#include <cstdio>

#include "Comparator.h"

const string f = "-f";
const string empty = "";
const string space = " ";

int main(int argc, char* argv[]){
	int whichEvent = 1;
	
	//simple way of loading in multiple files
//	EventProcessor process;
//	for(int k=0; k< argc; k++)
//	{
//		cout<<"Reading file " << argv[k] << " ...";
//		XMLParser parser(argv[k]);
//		cout<<"done."<<endl;
//		
//		cout<<"Processing file " << argv[k] << " ...";
//		process.add(parser.getEvents());
//		cout<<"done." << endl;
//	}
	
	DayTime dt = DayTime(1.25);
	DayParser dp = DayParser(20061111);
	cout<<dt.getHour()<<endl;
	cout<<dt.getMinute()<<endl;
	cout<<dp.getDay()<<endl;
	cout<<dp.getDayOfWeek()<<endl;
	cout<<"Reading file...";
	XMLParser parser("source.xml", whichEvent);
	vector<Event*> events = parser.getEvents();
	events.push_back(new Appt(20061107, 11.26, 12.4, "beer"));
	events.push_back(new Appt(20061107, 14.26, 18.4, "beer pong"));
	events.push_back(new Appt(20061108, 11.26, 19.4, "pong of the beer"));
	events.push_back(new Appt(20061109, 21.32, 23.4, "party where i get real drunk"));
	events.push_back(new Appt(20061110, 14.50, 16.05, "hangover"));
	events.push_back(new Appt(20061110, 22.26, 23.47, "15 shots"));
	events.push_back(new Appt(20061111, .30, 14.41, "emergency room"));
	events.push_back(new Appt(20061108, 0.0, 23.59, "the day i drink all day"));
	cout<<"done."<<endl;
	/*some tests
	sort(testEvents.begin(), testEvents.end(), Comparitor<Event> (new Sorter<Event>()));
	for(unsigned int k = 0; k< testEvents.size()-1; k++)
	{
		Event a = testEvents.at(k);
		cout << a.getDay() << space << a.getDescription()<<endl;
		cout << " is same as next Event ";
		if(a==testEvents[k+1])
			cout << "true";
		else cout << "false";
		cout << endl;
	}
	*/
	cout<<"Processing...";
	HTMLOutputter out;
	EventProcessor process(events);
	cout<<"done." << endl;
	
	cout<<"Outputting...";
	process.generateHTML(out);
	cout<<"done."<<endl;
	cout<<"Program completed."<<endl;
	
	return 0;
}
